package cn.com.note.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

import cn.com.note.R;
import cn.com.note.view.LoadingAlertDialog;
import cn.com.note.view.LoadingButton;

/**
 * Created by sunfulin on 2019/1/5.
 */

public class PopViewActivity extends AppCompatActivity implements View.OnClickListener {
    boolean isEnable = true;
    LoadingAlertDialog alertDialog;
    TextView tvValue;
    LoadingButton btLogin;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_triangle_down);
        findViewById(R.id.bt_alert).setOnClickListener(this);
        tvValue = findViewById(R.id.tv_value);
        btLogin = findViewById(R.id.btLogin);
        btLogin.setOnClick(this);
        alertDialog = new LoadingAlertDialog(this);
        btLogin.setText("登录");
    }
    boolean isShwo;
    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.bt_alert:
                alertDialog.show();
                initDevice();
                break;
            case R.id.btLogin:
                isShwo=!isShwo;
                if(isShwo){
                    btLogin.setShowLoading(isShwo, "登录中...");
                }else{
                    btLogin.setText("登录");
                }
                break;
        }
    }

    private void initDevice() {
        String s = android.os.Build.DEVICE + "|";
        s += android.os.Build.PRODUCT + "|";
        s += android.os.Build.HARDWARE + "|";
        s += android.os.Build.DISPLAY + "|";
        s += android.os.Build.MODEL + "|";
        s += android.os.Build.BRAND + "|";
        tvValue.setText(s);
    }
}
